package com.itxuchao.demo1;

import java.util.Scanner;

public class Demo4 {
    public static void main(String[] args) {
        /*Scanner sc = new Scanner(System.in);
        System.out.println("请输入开始兔子个数:");
        int num=sc.nextInt();
        System.out.println("请输入月份数:");
        int m=sc.nextInt();
        for (int month=1 ;  month<=m; month++) {
            if (month>=3){
                num++;
                num=Busitu(month,num);
            }
        }//主兔子
        System.out.println("经过"+m+"个月,兔子变成了"+num+"只");
    }
    public static int Busitu(int month,int num){
            for (  int month2=1; month2<=month; month2++) {
                if (month2>=3){
                    num++;
                }
            }//下一个兔子
        return num;*/
        int[] arr = new int[20];
        arr[0]=1;
        arr[1]=1;
        for (int i = 2; i <arr.length; i++) {
            arr[i]=arr[i-1]+arr[i-2];
        }
        System.out.println("20个月后兔子一共有:"+arr[19]+"个");

    }
}
